package org.starsource.forum.server.transaction;

import java.util.Set;

import org.starsource.forum.client.exception.DatabaseException;
import org.starsource.forum.client.exception.PermissionDeniedException;
import org.starsource.forum.client.exception.SessionNotFoundException;
import org.starsource.forum.server.domain.Category;
import org.starsource.forum.server.domain.Session;
import org.starsource.forum.server.domain.User;

/*
 * 关于Session的权限问题：
 *
 * Session的权限体现在哪里？
 * (1) Session对谁可见：完全公开、仅好友可见、私密（仅Session的User可见）
 * (2) Session对谁可见的控制权：Owner
 * (3) 谁可以在Session中发言：Owner、User、Group
 * (4) 谁可以在Session中发言的控制权：删除用户的权限（Owner），添加用户的权限（Owner，见到的人是否可以Join：Joinable为true，用户是否可以邀请：不可以邀请）
 */
public interface SessionTransaction {

	public Session	createSession(User requester, String title, Category category) throws DatabaseException;
	public void		updateSession(User requester, Session session) throws DatabaseException;
	public void		removeSession(User requester, Session session) throws PermissionDeniedException, DatabaseException;

	public Session	getSession(User requester, int id) throws SessionNotFoundException, DatabaseException;

	public Set<Session> getSessionSet(User requester) throws DatabaseException;
	public Set<Session> getSessionSet(User requester, Category category) throws DatabaseException;
	public Set<Session> getSessionSet(User requester, Set<Category> categories) throws DatabaseException;
	public Set<Session> getSessionSetByKeywords(User requester, String[] keywords) throws DatabaseException;

}
